<%@ page import="framework.common.Common" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
    <meta charset="utf-8">
    <title>牛皮</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">

    <!-- 引入框架的js、css等 -->
    <jsp:include page="${request.contextPath}/static/include.jsp" flush="true"/>
    <%-- 模态框的css --%>
    <link rel="stylesheet" href="<%=request.getContextPath()%>/static/css/modal.css?ver=<%=System.currentTimeMillis()%>"/>

    <script type="text/javascript">
        //关闭窗口的时候刷新table，防止文件上传后没有及时刷新
        function closeLayer(){
            reloadTable("_rightTable");
        }

        //一般直接写在一个js文件中
        layui.use(['form', 'layer', 'upload'], function () {
            var form = layui.form
                ,$ = layui.jquery
                ,upload = layui.upload;

            verifyExt(form);
            form.on('submit(*)', function (data) { //form校验成功才会执行下面的代码
                ajax("/aj/AjJs.do?method=update", serializeObject($("#bofrom")), {refreshedTableId: "_rightTable"});
                return false; //禁用form表单自带的提交
            });

            //拖拽上传
            upload.render({
                elem: '#jsFileUpload'
                ,url: '/Upload.do?method=upload&uuid=${bo.uuid}&sysFileModuleLid=${sysFileModule_jsFile}'
                ,accept: 'file'
                ,done: function(res){
                    if(res.code == RESPONSE_SUCCESS){
                        $("#jsFileUpload #fileName").html(res.data.name);
                    }else{
                        layer.comfirm(res.msg);
                    }
                }
            });
        });
    </script>
</head>

<body class="childBody">
<form id="bofrom" class="layui-form">
    <%-- 主键 --%>
    <input type="hidden" name="lid" value="${param.lid}">

    <div class="layui-form-item">
        <label class="layui-form-label"><span style="color:red">*</span>脚本单价</label>
        <div class="layui-input-block">
            <input type="text" name="price" value="${bo.price}" class="layui-input" lay-verify="required|decimal" verify-decimal=">11,2">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><span style="color:red">*</span>版本号</label>
        <div class="layui-input-block">
            <input type="text" name="version" value="${bo.version}" class="layui-input" lay-verify="required">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><span style="color:red">*</span>版本说明</label>
        <div class="layui-input-block">
            <textarea name="remark" class="layui-textarea" lay-verify="required">${bo.remark}</textarea>
        </div>
    </div>
        <div class="layui-form-item">
            <label class="layui-form-label"><span style="color:red">*</span>百度云连接</label>
            <div class="layui-input-block">
                <input type="text" name="baiduUrl" value="${bo.baiduUrl}" class="layui-input" lay-verify="required">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">百度云提取码</label>
            <div class="layui-input-block">
                <input type="text" name="baiduCode" value="${bo.baiduCode}" class="layui-input">
            </div>
        </div>
    <div class="layui-form-item">
        <label class="layui-form-label"><span style="color:red">*</span>脚本文件</label>
        <div class="layui-input-block">
            <div class="layui-upload-drag" id="jsFileUpload">
                <i class="layui-icon"></i>
                <p id="fileName">${bo.fileMap.jsFile[0].name}</p>
                <%--<p id="fileName">点击上传，或将文件拖拽到此处</p>--%>
            </div>
        </div>
    </div>

    <!--隐藏的提交按钮，提供父页面调用  -->
    <div class="layui-form-item" style="display: none;">
        <div class="layui-input-inline">
            <button class="layui-btn form-submit-btn" lay-submit="" lay-filter="*">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
</body>
</html>
